<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="t" uri="http://training.linesno.com/jsp/jstl/training"%>

<!--
@desc  修改
@author LuoAnDong
@since 2019-04-30 16:44:34
-->

<t:body>
	<div class="col-md-12 col-lg-12">
		<div class="panel panel-default training-panel-add">
			<div class="panel-body">
				<br/>
				<form class="form-horizontal" name="trainingAddForm">

<t:input label="areadlyDead" name="areadlyDead" />
<t:input label="businessBody" name="businessBody" />
<t:input label="businessDateType" name="businessDateType" />
<t:input label="businessId" name="businessId" />
<t:input label="createTime" name="createTime" />
<t:input label="creater" name="creater" />
<t:input label="editTime" name="editTime" />
<t:input label="editor" name="editor" />
<t:input label="field1" name="field1" />
<t:input label="field2" name="field2" />
<t:input label="field3" name="field3" />
<t:input label="messageSendTimes" name="messageSendTimes" />
<t:input label="messageStatus" name="messageStatus" />
<t:input label="remark" name="remark" />
<t:input label="topic" name="topic" />
<t:input label="versions" name="versions" />

<t:input name="${keyPropertyName}" optionJson="{readonly:'true',style:'display:none'}"/>

					<t:submit label="提交" />

				</form>
			</div>
		</div>
	</div>

<script tpe="text/javascript">

	//用name绑定需要验证的元素
	tt.vf.req.add(
"areadlyDead" ,
"businessBody" ,
"businessDateType" ,
"businessId" ,
"createTime" ,
"creater" ,
"editTime" ,
"editor" ,
"field1" ,
"field2" ,
"field3" ,
"messageSendTimes" ,
"messageStatus" ,
"remark" ,
"topic" ,
"versions" 
	);

	var layerLoading ;
	var option = {
		url : '${ctx}handle/base/message/transactionMessage/update.do',
		type : 'POST',
		success : function(data) {
			console.log("back data : " + data)
			layer.close(layerLoading);
			if (data.status == 200) {
				top.layer.msg("更新成功.");
				$("form[name=trainingAddForm]")[0].reset() ;
				top.refreshJqgrid("list") ;
			}else {
				top.layer.msg("更新失败.") ;
			}
		},
		dataType : "json",
		timeout : 30000 // 超时时间设置为30秒
	}

	function trainingSubmit() {
		console.log("trainingSubmit") ;
		if (tt.validateForm('trainingAddForm')) { //addForm是form的name
			layerLoading = layer.load() ;
			$("form[name=trainingAddForm]").ajaxSubmit(option);
		}
	}

	$(function(){
		$.ajax({
			url : '${ctx}handle/base/message/transactionMessage/detail.do?id=${id}',
			type: 'post',
			dataType : 'json',
			timeout : 3000,
			success: function (text) {
				$("form[name=trainingAddForm]").autofill(text.data);
			}
		});
	}) ;
</script>

</t:body>

